package com.example.tossednfound;

/**
 * Regular User 
 * Profile details for a non-admin user
 */

public class RegUser extends User{
	int loginCount;
	public boolean isLocked;
	/**
	 * Constructor which takes in all the info to be stored in the User object
	 * @param emailin
	 * @param passwordin
	 * @param addressin
	 * @param statein
	 * @param zipcodein
	 * @param countryin
	 * @param namein
	 */
	public RegUser(String emailin, String passwordin, String addressin, String statein, int zipcodein, String countryin, String namein ){
		email = emailin;
		password = passwordin;
		address = addressin;
		state = statein;
		zipcode = zipcodein;
		country = countryin;
		name = namein;
		loginCount = 0;
		isLocked = false;
	}
	public boolean checkCredentials(String emailin, String passwordin){
		if(emailin.equals(email)){
			if (loginCount > 2) {
				isLocked = true;
				return false;
			}
			loginCount++;
			if(passwordin.equals(password)) loginCount = 0;
			return passwordin.equals(password);
		}
		return false;
	}
}
